package com.guigu.service.impl.stock;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guigu.mapper.stock.SysUsersMapper;
import com.guigu.pojo.stock.SysUsers;
import com.guigu.service.stock.SysUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mr.Zhang
 * @since 2024-12-06
 */
@Service
public class SysUsersServiceImpl extends ServiceImpl<SysUsersMapper, SysUsers> implements SysUsersService {

    @Autowired
    private SysUsersMapper sysUsersMapper;

    @Override
    public SysUsers login(SysUsers sysUsers) {
        QueryWrapper<SysUsers> wrapper = new QueryWrapper<>();
        wrapper.eq("LOGIN_ID", sysUsers.getLoginId());
        wrapper.eq("PASSWORD", sysUsers.getPassword());
        sysUsers = sysUsersMapper.selectOne(wrapper);
        return sysUsers;
    }

    @Override
    public SysUsers selectSysUserById(Integer id) {
        SysUsers sysUsers = sysUsersMapper.selectUserAndRole(id);
        return sysUsers;
    }
}
